package io.github.mayubao.tinkerpatch_sample;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import io.github.mayubao.tinkerpatch_sample.utils.MLog;

public class MainActivity extends AppCompatActivity {

    // Used to load the 'native-lib' library on application startup.
    static {
        System.loadLibrary("native-lib");
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Example of a call to a native method
        TextView tv = (TextView) findViewById(R.id.sample_text);
        tv.setText(stringFromJNI());

        //Bug1.假设在这里修改了TextView的内容
//        tv.setText("Change the UI！");

        //Bug4.添加新的Activity
        ImageView iv_sample = (ImageView) findViewById(R.id.iv_sample);
        iv_sample.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MLog.i("iv_sample===>>>");
                Intent intent = new Intent(MainActivity.this, NewActivity.class);
                startActivity(intent);
            }
        });

        //Bug5 add Proguard and verify ?
        tv.setText("minify enable = true");
        iv_sample.setImageResource(R.mipmap.ic_launcher_round);
    }

    /**
     * A native method that is implemented by the 'native-lib' native library,
     * which is packaged with this application.
     */
    public native String stringFromJNI();
}
